﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VSWClient.Utility
{
	public static class Formats
	{
		//public static DateTimeFormatInfo GetDateFormat()
		//{
		//	DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
		//	dtFormat.LongDatePattern = "yyyy/MM/dd HH:mm:ss";
		//	return dtFormat;
		//}

		public static string DataFormat = "yyyy-MM-dd HH:mm:ss";
		public static string GetDateFormat()
		{
			return "yyyy-MM-dd HH:mm:ss";
		}
		
		public static string GetShortFormat()
		{
			return "yyyy-MM-dd";
		}
		public static string GetTimeFormat()
		{
			return "HH:mm:ss";
		}
		public static string GetTimeHourFormat()
		{
			return "HH";
		}

		public static string LongFormat = "yyyy-MM-dd HH:mm:ss fff";
		public static string GetLongFormat()
		{
			return "yyyy-MM-dd HH:mm:ss fff";
		}

		public static string DowntimeIdFormat = "yyMMddHHmmss";

		public static string BundleIdFormat = "yyMMddHHmmssfff";


		/// <summary>
		/// unit conversion
		/// </summary>
		/// <param name="number">data value</param>
		/// <param name="unit">data unit</param>
		/// <returns></returns>
		public static string ConvertUnit(string number, double unit)
		{
			try
			{
				double num = double.Parse(number);
				string value = (num / unit).ToString();
				string[] result = value.Split('.');
				if (result.Length > 0)
					return result[0];
				else
					return "0";
			}
			catch (Exception ex)
			{
				LogHelper.WriteLog("ConvertUnit", ex);
				return "0";
			}
		}
	}

	public class VswUnit
	{
		public static double STRIP_THK_L1 = 0.01;
		public static double STRIP_THK_L2 = 100.0;

		public static double STRIP_WIDTH_L1 = 0.1;
		public static double STRIP_WIDTH_L2 = 10.0;

		public static double Yeild_Strength_L1 = 1.0;
		public static double Yeild_Strength_L2 = 1.0;

		public static double ACC_PR_PRESSURE_L1 = 1.0;
		public static double ACC_PR_PRESSURE_L2 = 1.0;

		public static double PIPE_OD_L1 = 0.01;
		public static double PIPE_OD_L2 = 100.0;

		public static double PIPE_WT_L1 = 0.01;
		public static double PIPE_WT_L2 = 100.0;

		public static double INNER_BEAD_HEIGHT_L1 = 0.01;
		public static double INNER_BEAD_HEIGHT_L2 = 100.0;

		public static double INNER_BEAD_Depth_L1 = 0.01;
		public static double INNER_BEAD_Depth_L2 = 100.0;

		public static double STRAIGHTNESS_L1 = 0.01;
		public static double STRAIGHTNESS_L2 = 100.0;

		public static double EM_Cut_SPD_L1 = 1.0;
		public static double EM_Cut_SPD_L2 = 1.0;

		public static double EM_CHIPLOAD_L1 = 0.001;
		public static double EM_CHIPLOAD_L2 = 1000.0;



		public static double Strip_WD_Target_L1 = 0.1;
		public static double Strip_WD_Target_L2 = 10.0;

		public static double HFW_SPC_Gain_L1 = 1.0;
		public static double HFW_SPC_Gain_L2 = 1.0;

		public static double HFW_SPC_Slope_L1 = 0.001;
		public static double HFW_SPC_Slope_L2 = 1000.0;


		public static double Bld_OD_L1 = 0.1;
		public static double Bld_OD_L2 = 10.0;

		public static double Bld_WT_L1 = 0.1;
		public static double Bld_WT_L2 = 10.0;

		public static double Bld_CutArea_L1 = 0.001;
		public static double Bld_CutArea_L2 = 1000.0;

		public static double FLT_Gap_L1 = 1.0;
		public static double FLT_Gap_L2 = 1.0;

		public static double FLT_Time_L1 = 1.0;
		public static double FLT_Time_L2 = 1.0;

		public static double FLT_SPD_L1 = 1.0;
		public static double FLT_SPD_L2 = 1.0;
	}
}
